package com.bite.system.manager;
import com.bite.common.core.constants.CacheConstants;
import com.bite.common.redis.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class QuestionCacheManager {
    @Autowired
    private RedisService redisService;
    //redis里面可能没有数据，所以是找mysql,然后同步一下,
    //我们面对一个问题，假如我进行新增题目，和删除题目时候，那么缓存的更新
   public void addCache(Long questionId){
       //新增，应该放到最左边，即最新的
       redisService.leftPushForList(CacheConstants.QUESTION_LIST,questionId);
   }
   public  void  deleteCache(Long questionId) {
       redisService.removeForList(CacheConstants.QUESTION_LIST,questionId);
   }
}
